const {merge} = require('webpack-merge')
const base = require('./base')

const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')

module.exports = merge(base, {
  mode: 'production',
  devtool: 'source-map',
  optimization: { //优化
    splitChunks: { //为chunk专门生成单独的js文件
      chunks: 'all'
    },
    minimizer: [//最小化,压缩文件插件
      new UglifyJsPlugin(),
      new CssMinimizerPlugin()
    ]
  }
})